Item Collection
The list of items is stored in the instvar coll. This collection is specified in the constructor and can additionally be set with the method SetCollection. It is checked whether all items in the collection are instances of the class VObject. If objects are added to the collection later, then the client itself has to ensure that they are "kind of" VObject.
The CollectionView registers itself as an observer of the instvar coll which enables it to recalculate the layout whenever the collection changes.
Any type of Collection may be used. But if it is heavily modified and execution speed is important, then it is recommended to use an instance of the class OrdCollection because CollectionView very often accesses items in the collection by index.
The destructor of CollectionView always destroys the collection and the contained items. If the items are to be reused, then either single items or the whole collection should be saved before deleting the CollectionView.
Layout
The items of a CollectionView are arranged in columns and rows and the available space for an item is referred to as cell. The layout is determined by the flags eCVExpandCols and eCVExpandRows (see enum CollViewOptions) as well as the instvar cols and the instvar rows which all can be specified in the constructor. Three main types of layouts are possible:
1. number of columns is fixed; CollectionView grows vertically - either set the flag eCVExpandRows - or set the instvar rows to 0 2. number of rows is fixed; CollectionView grows horizontally - either set the flag eCVExpandCols - or set the instvar cols to 0 3. square layout; CollectionView grows both horizontally and vertically - either set the flags eCVExpandCols and eCVExpandRows - or set both the instvar cols and the instvar rows to 0The items in the instvar coll are aligned column first. For example, in a two column layout the items would be arranged like this:
1 4 2 5 3 6The layout can further be customized by modifying the instvar gap and the instvar minExtent. The gap is the space to reserve between two cells. The minimum extent contains the minimum size of a single cell. These values can be set with the method SetGap, respectively the method SetMinExtent.
Selecting Items
Single items can be selected with the left mouse button. While the mouse button is pressed and moved the method DoOnItem is continuously called. It forwards the message to the currently selected item, by default. When the mouse button is released the method DoSelect is called. The default implementation informs the next event handlers via the method Control about which item has been selected and whether a single or double click has been used.
The instvar selection stores the column and row numbers of the selected items. Clients may actively modify the current selection through the method SetSelection or the method SetNoSelection.
classes are rarely derived from CollectionView.
class CollectionView
is often reused directly.
class CollectionView contains 36 methods.
origin.x column number of first selected cell origin.y row number of first selected cell extent.x number of columns selected to the right extent.y number of rows selected to the bottomWhether there is a selection at all can be checked with GetSelection().IsEmpty(). Selected items can be accessed by passing the column and row number to the method GetItem.
Standard Views
The method DoLeftButtonDownCommand creates instances of the class CellSelector that does not allow to select more than one cell concurrently though the implementation of CollectionView would allow this.
Other problems: see method DoSelect, method Draw and method ReadFrom.
man2html: unable to open or read file ../mann/CollectionView::CollectionView.n
man2html: unable to open or read file ../mann/CollectionView::ConstrainScroll.n
man2html: unable to open or read file ../mann/CollectionView::DoCreateMenu.n
man2html: unable to open or read file ../mann/CollectionView::DoKeyCommand.n
man2html: unable to open or read file ../mann/CollectionView::DoLeftButtonDownCommand.n
man2html: unable to open or read file ../mann/CollectionView::DoObserve.n
man2html: unable to open or read file ../mann/CollectionView::DoOnItem.n
man2html: unable to open or read file ../mann/CollectionView::DoSelect.n
man2html: unable to open or read file ../mann/CollectionView::DoSelect2.n
man2html: unable to open or read file ../mann/CollectionView::Draw.n
man2html: unable to open or read file ../mann/CollectionView::DrawGrid.n
man2html: unable to open or read file ../mann/CollectionView::GetCollection.n
man2html: unable to open or read file ../mann/CollectionView::GetItem.n
man2html: unable to open or read file ../mann/CollectionView::GetMenu.n
man2html: unable to open or read file ../mann/CollectionView::GetMinSize.n
man2html: unable to open or read file ../mann/CollectionView::GetSelection.n
man2html: unable to open or read file ../mann/CollectionView::InvalidateItemRect.n
man2html: unable to open or read file ../mann/CollectionView::ItemPos.n
man2html: unable to open or read file ../mann/CollectionView::ItemRect.n
man2html: unable to open or read file ../mann/CollectionView::Modified.n
man2html: unable to open or read file ../mann/CollectionView::Parts.n
man2html: unable to open or read file ../mann/CollectionView::PointToItem.n
man2html: unable to open or read file ../mann/CollectionView::PrintOn.n
man2html: unable to open or read file ../mann/CollectionView::PrintOnWhenObserved.n
man2html: unable to open or read file ../mann/CollectionView::ReadFrom.n
man2html: unable to open or read file ../mann/CollectionView::SetCollection.n
man2html: unable to open or read file ../mann/CollectionView::SetDefaultItem.n
man2html: unable to open or read file ../mann/CollectionView::SetGap.n
man2html: unable to open or read file ../mann/CollectionView::SetMenu.n
man2html: unable to open or read file ../mann/CollectionView::SetMinExtent.n
man2html: unable to open or read file ../mann/CollectionView::SetNoSelection.n
man2html: unable to open or read file ../mann/CollectionView::SetOrigin.n
man2html: unable to open or read file ../mann/CollectionView::SetSelection.n
man2html: unable to open or read file ../mann/CollectionView::Update.n
man2html: unable to open or read file ../mann/CollectionView::~CollectionView.n